package de.pinguair.fpm;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class start extends Activity {
	
	private static final int HELP = 0;
	private static final int EXIT = 1;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
        
    /* Code for Main Menu */
    public boolean onCreateOptionsMenu(Menu menu){
		menu.add(0,HELP,0,"Help");
		menu.add(0,EXIT,0,"Exit");
    	return true;
    }

    public boolean onOptionsItemSelected (MenuItem item) {	
    	switch (item.getItemId()){
			case HELP:
				Context context = getApplicationContext();
				CharSequence text = "In Progress!";
				int duration = Toast.LENGTH_SHORT;
				Toast toast = Toast.makeText(context, text, duration);
				toast.show();
				return true;
	
			case EXIT:
				finish();
				return true;
    	}
    	return false;
    }
    /* Code for Main Menu END */
    
    /* Listener for Buttons */
    /* Starts Settings Preference Screen */
    public void onClickmainButton1(final View sfNormal) {
    	startActivity(new Intent(this, KlickProfileSettings.class));
    }
    
    /* Starts Aircraft Preference Screen */
    public void onClickmainButton2(final View sfNormal) {
    	startActivity(new Intent(this, KlickFlightplanSettings.class));
    }
    
    public void onClickmainButton3(final View sfNormal) {
    	/* Code for Kontextmenue for Button3 */
    	final CharSequence[] items = {"Saved - FPL's", "Submited - FPL's"};

    	AlertDialog.Builder builder = new AlertDialog.Builder(this);
    	builder.setTitle("Pick an option:");
    	builder.setItems(items, new DialogInterface.OnClickListener() {
    		
    	    public void onClick(DialogInterface dialog, int item) {
    	        Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
    	    }
    	});
    	//AlertDialog alert = builder.create();
    	builder.show();
    	/* Code for Kontextmenue for Button3 END */
    }
    
    public void onClickmainButton4(final View sfNormal) {
    	Context context = getApplicationContext();
		CharSequence text = "Sorry... In Progress!";
		int duration = Toast.LENGTH_SHORT;
		Toast toast = Toast.makeText(context, text, duration);
		toast.show();
    }
    
    public void onClickmainButton5(final View sfNormal) {
    	Context context = getApplicationContext();
		CharSequence text = "Sorry... In Progress!";
		int duration = Toast.LENGTH_SHORT;
		Toast toast = Toast.makeText(context, text, duration);
		toast.show();
    }
    
    public void onClickmainButton6(final View sfNormal) {
    	Context context = getApplicationContext();
		CharSequence text = "Sorry... In Progress!";
		int duration = Toast.LENGTH_SHORT;
		Toast toast = Toast.makeText(context, text, duration);
		toast.show();
    }
}